//
//  SystemMessageViewController.m
//  YJlandlord
//
//  Created by 文彬 on 2018/6/26.
//  Copyright © 2018年 文彬. All rights reserved.
//

#import "SystemMessageViewController.h"
#import "SystemMessageTableViewCell.h"
#import "UILabel+ChangeLineSpaceAndWordSpace.h"

@interface SystemMessageViewController ()<UITableViewDataSource,
    UITableViewDelegate>

@property (strong, nonatomic) UITableView *listTableView;

@end

@implementation SystemMessageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationItem.title = @"系统消息";
    
    [self initPageControl];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
#pragma mark 页面相关
- (void)initPageControl{
    
    [self.view addSubview:self.listTableView];
    [self.listTableView makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@10);
        make.right.equalTo(@-10);
        make.top.equalTo(@0);
        make.bottom.equalTo(@0);
    }];
}

#pragma mark UITableView
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 5;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 10;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return 140;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    SystemMessageTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SystemMessageTableViewCell" forIndexPath:indexPath];
    cell.layer.cornerRadius = 5;
    cell.titleLabel.text = @"特卖频道问卷调查";
    cell.detailLabel.text = @"您好，为提供更好的服务，邀请您参与特卖频道问卷调查，有机会获得300意居红包！";
    [UILabel changeLineSpaceForLabel:cell.detailLabel WithSpace:4];
    return cell;
    
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    
}


- (UITableView*)listTableView{
    if (_listTableView==nil) {
        _listTableView = [[UITableView alloc]initWithFrame:CGRectZero style:UITableViewStyleGrouped];
        _listTableView.delegate = self;
        _listTableView.dataSource = self;
        _listTableView.sectionFooterHeight = 0;
        _listTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        _listTableView.backgroundColor = [UIColor clearColor];
        [_listTableView registerNib:[UINib nibWithNibName:@"SystemMessageTableViewCell" bundle:nil] forCellReuseIdentifier:@"SystemMessageTableViewCell"];
    }
    
    return _listTableView;
}

@end
